package com.wuliu.servlet;

import com.wuliu.dao.FirstImageDAO;
import com.wuliu.dao.impl.FirstImageDAOImpl;
import com.wuliu.model.FirstImage;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/admin/first_image")
public class AdminFirstImageServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        FirstImageDAO firstImageDAO=new FirstImageDAOImpl();
        List<FirstImage> firstImages=firstImageDAO.findAll();
        req.setAttribute("firstImages",firstImages);

        req.getRequestDispatcher("/WEB-INF/view/admin/first_image.jsp").forward(req,resp);


    }
}
